xen: arm: introduce raw_copy_to_guest_flush_dcache() function
authorOleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>
Wed, 27 Nov 2013 17:09:51 +0000 (19:09 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 29 Nov 2013 10:29:04 +0000 (10:29 +0000)
This function flushes the dcache while copying the data.

Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall<julien.grall@linaro.org>
xen/arch/arm/guestcopy.c
xen/include/asm-arm/guest_access.h

index d146cd60e412a039747560d1ff339f7cdd4466bf..08800a406a934c09594244fded08c8f8e49c1c91 100644 (file)
@@ -5,7 +5,8 @@
 #include <asm/mm.h>
 #include <asm/guest_access.h>
 
-unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len)
+static unsigned long raw_copy_to_guest_helper(void *to, const void *from,
+                                              unsigned len, unsigned flush_dcache)
 {
     /* XXX needs to handle faults */
     unsigned offset = (vaddr_t)to & ~PAGE_MASK;
@@ -24,6 +25,8 @@ unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len)
         p = map_domain_page(g>>PAGE_SHIFT);
         p += offset;
         memcpy(p, from, size);
+        if ( flush_dcache )
+            flush_xen_dcache_va_range(p, size);
 
         unmap_domain_page(p - offset);
         len -= size;
@@ -35,6 +38,17 @@ unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len)
     return 0;
 }
 
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len)
+{
+    return raw_copy_to_guest_helper(to, from, len, 0);
+}
+
+unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from,
+                                             unsigned len)
+{
+    return raw_copy_to_guest_helper(to, from, len, 1);
+}
+
 unsigned long raw_clear_guest(void *to, unsigned len)
 {
     /* XXX needs to handle faults */
index 8ff088f39ae9c06d0bbed388bf87f97e2f6e31d9..5876988b232e1ee43138a640da3526ad6faec3a9 100644 (file)
@@ -11,6 +11,8 @@
     (likely(count < (~0UL/size)) && access_ok(addr,count*size))
 
 unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
+unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from,
+                                             unsigned len);
 unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
 unsigned long raw_clear_guest(void *to, unsigned len);